//
//  UIBarButtonItem + extention.swift
//  WeiBo
//
//  Created by wukeng on 16/8/23.
//  Copyright © 2016年 wukeng. All rights reserved.
//

import UIKit

extension UIBarButtonItem{
    //方法1
//    convenience init(imageName : String) {
//        self.init()
//        let btn = UIButton()
//        btn.setImage(UIImage(named: imageName), forState: .Normal)
//        btn.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
//        btn.sizeToFit()
//        self.customView = btn
//    }
    //方法2
    convenience init(imageName : String) {
        let btn = UIButton()
        btn.setImage(UIImage(named: imageName), forState: .Normal)
        btn.setImage(UIImage(named: imageName + "_highlighted"), forState: .Highlighted)
        btn.sizeToFit()
        self.init(customView :btn)
    }
}
